package org.example.promax.service.Iml;


import org.example.promax.entity.User;
import org.example.promax.service.Userservice;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserSerivceIml implements Userservice {
    //    @Autowired
    JdbcTemplate jdbcTemplate;

    public UserSerivceIml(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public int addUser(User user) {
        String sql = "insert into user (username, password,sex) values (?,?,?)";
        return jdbcTemplate.update(sql, user.getUsername(), user.getPassword(), user.getSex());
    }
}
